import axios from 'axios'


export const get = async (url: string, data: any = {}) => {
  try {
    return await axios.get(url, {
      params: {
        ...data
      }
    })
  } catch(err) {
    return err
  }
}

export const post = async (url: string, data: any = {}) => {
  try {
    return await axios.post(url, { ...data })
  } catch(err) {
    return err
  }
}

export const put = async (url: string, data: any = {}) => {
  try {
    return await axios.put(url, { ...data })
  } catch(err) {
    return err
  }
}

export const deleteFun = async (url: string, params = {}) => {
  try {
    return await axios.delete(url, params)
  } catch(err) {
    return err
  }
}
